package com.ph.util;

import java.util.Random;

public final class StringUtil {

	public static boolean isNull(String str) {
		if (str.equals(""))
			return true;
		else
			return false;
	}

	public static String handleGrade(String grade) {
		if (grade == null || grade.equals(""))
			grade = "0";
		return grade;
	}

	public static String removeLastComma(String str) {
		return str.substring(0, str.lastIndexOf(","));
	}

	public static String generateRandomString() {
		return String.format("%06d", new Random().nextInt(1000000));
	}

	public static String generateSequenceNumber(String x, String suffix) {
		if(x!=null){
			return String.format("%06d", Integer.parseInt(x.split(suffix)[1]) + 1);
		}else{
			return String.format("%06d", 1);
		}
		
	}

}
